<html>
<head>
  <!script type="text/javascript" src="../tools/ace/build_support/mini_require.js"></script>
  <script type="text/javascript" src="../tools/ace/build/src/ace.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/utils.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/auto_brace_insert.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/doc_comment_highlight_rules.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/tex_highlight_rules.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/token_cursor.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/token_utils.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/r_highlight_rules.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/r_matching_brace_outdent.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/r_scope_tree.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/r_code_model.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/background_highlighter.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/cpp_scope_tree.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/cpp_code_model.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/c_cpp_fold_mode.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/c_cpp_style_behaviour.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/c_cpp_matching_brace_outdent.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/c_cpp_highlight_rules.js"></script>
  <script type="text/javascript" src="../acesupport/acemode/c_cpp.js"></script>
  <style type="text/css">
  pre {
    margin-bottom: 30px;
    padding: 3px;
    border: 1px solid #999;
  }
  .error {
    position: absolute;
    background-color: #D77;
  }


  </style>
</head>
<body>

  <h2>C++ Operator Highlight Tester</h2>
  <div id="editor" style="position: aboluste; width: 600px; height: 600px; border: 1px solid #999"></div>

  <script type="text/javascript">

  var CppMode = require("mode/c_cpp").Mode;
  var Range = require("ace/range").Range;

  var operatorTokens = [

     ">>=", "<<=", "new", "delete", "->*",
     
     "<<", ">>", "&&", "||", "==", "!=", "<=", ">=", "::",
     "*=", "+=", "-=", "/=", "++", "--", "&=", "^=",
     "%=", "->", "()", "[]", "->",
     
     "!", "$", "&", "|", "*", "-", "+", "~", "=",
     "<", ">", "," 
     
  ];

  var text = "";
  text += "operator " + operatorTokens.join("\noperator ");

  var editor = ace.edit("editor");
  var session = editor.getSession();
  session.setMode(new CppMode(false, session));

  editor.insert(text);

  // highlight bad lines
  var markers = [];
  var n = session.getLength();
  var count = n;
  for (var i = 0; i < n; i++) {
    var tokens = session.getTokens(i);
    if (tokens.length !== 1) {
      count--;
      session.addMarker(
          new Range(i, 0, i, session.getLine(i).length),
          "error",
          "fullLine"
          );
    }
  }

  var div = document.createElement("div");
  div.innerHTML = "Passed " + count + " of " + n + " tests.";
  document.body.appendChild(div);

  </script>

</body>

</html>
